package com.chuanke.ckfamily.dao.user.model;

import com.weijie.core.extend.FiledName;
import com.weijie.core.extend.IgnoreColumn;
import com.weijie.core.extend.NoIncreament;
import com.weijie.core.extend.TableName;
import com.weijie.core.model.BaseModel;
import com.weijie.core.util.DateUtils;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;

@TableName("cf_user")
@NoIncreament
public class User extends BaseModel implements Serializable{
	private static final long serialVersionUID = 5061157065936497275L;
	// 网易云信
	private String user_no;
	@FiledName("user_no")
	public String getUser_no(){
		return this.user_no;
	}
	public void setUser_no(String user_no){
		 this.user_no = user_no;
	}

	// 手机
	private String mobile;
	@FiledName("mobile")
	public String getMobile(){
		return this.mobile;
	}
	public void setMobile(String mobile){
		 this.mobile = mobile;
	}

	// 用户昵称
	private String nick_name;
	@FiledName("nick_name")
	public String getNick_name(){
		return this.nick_name;
	}
	public void setNick_name(String nick_name){
		 this.nick_name = nick_name;
	}

	// 真实姓名
	private String real_name; 
	@FiledName("real_name")
	public String getReal_name(){
		return this.real_name;
	}
	public void setReal_name(String real_name){
		 this.real_name = real_name;
	}

	// 账户状态(0--正常，1--异常)
	private Integer account_status;
	@FiledName("account_status")
	public Integer getAccount_status(){
		return this.account_status;
	}
	public void setAccount_status(Integer account_status){
		 this.account_status = account_status;
	}

	// 性别 男:1 女:2  0是没有给
	private Integer sex;
	@FiledName("sex")
	public Integer getSex(){
		return this.sex;
	}
	public void setSex(Integer sex){
		 this.sex = sex;
	}

	// 生日
	private Timestamp birthday;
	@FiledName("birthday")
	public Timestamp getBirthday(){
		return this.birthday;
	}
	public void setBirthday(Timestamp birthday){
		 this.birthday = birthday;
	}

	// 用户头像
	private String pic;
	@FiledName("pic")
	public String getPic(){
		return this.pic;
	}
	public void setPic(String pic){
		 this.pic = pic;
	}

	// 创建时间
	private Timestamp create_time;
	@FiledName("create_time")
	public Timestamp getCreate_time(){
		return this.create_time;
	}
	public void setCreate_time(Timestamp create_time){
		 this.create_time = create_time;
	}

	// 更新时间
	private Timestamp update_time;
	@FiledName("update_time")
	public Timestamp getUpdate_time(){
		return this.update_time;
	}
	public void setUpdate_time(Timestamp update_time) {
		this.update_time = update_time;
	}

	// 用户token
	private String token;
	@FiledName("token")
	public String getToken(){
		return this.token;
	}
	public void setToken(String token){
		 this.token = token;
	}

	// 上级id
	private Long super_id;
	@FiledName("super_id")
	public Long getSuper_id(){
		return this.super_id;
	}
	public void setSuper_id(Long super_id){
		 this.super_id = super_id;
	}

	// 是否为管理员 0是普通用户，1是系统
	private Integer is_admin;
	@FiledName("is_admin")
	public Integer getIs_admin(){
		return this.is_admin;
	}
	public void setIs_admin(Integer is_admin){
		 this.is_admin = is_admin;
	}
	
	// 登录时间
	private Timestamp login_time;
	@FiledName("login_time")
	public Timestamp getLogin_time() {
		return login_time;
	}
	public void setLogin_time(Timestamp login_time) {
		this.login_time = login_time;
	}
	// 上级id用户给的粉丝  备注名
	private String remark_name;
	@FiledName("remark_name")
	public String getRemark_name() {
		return remark_name;
	}
	public void setRemark_name(String remark_name) {
		this.remark_name = remark_name;
	}

	// 网易token
	private String wy_token;
	@FiledName("wy_token")
	public String getWy_token() {
		return wy_token;
	}
	public void setWy_token(String wy_token) {
		this.wy_token = wy_token;
	}
	public boolean hasWyId(){
		return wy_token!=null && !"".equals(wy_token);
	}

	// 用户最后活跃时间
	private Timestamp active_time;
	@FiledName("active_time")
	public Timestamp getActive_time() {
		return active_time;
	}
	public void setActive_time(Timestamp active_time) {
		this.active_time = active_time;
	}
	private String active_timeStr;
	@IgnoreColumn
	public String getActive_timeStr() {
		if(this.active_time!=null){
			return DateUtils.format(new Date(this.active_time.getTime()),"yyyy-MM-dd");
		}
		return "未活跃";
	}

	// 用户是否是族长 0不是  1是
	private Integer is_header;
	@FiledName("is_header")
	public Integer getIs_header() {
		return is_header;
	}
	public void setIs_header(Integer is_header) {
		this.is_header = is_header;
	}
	
	// 粉丝数
	private Integer fansNum;
	@IgnoreColumn
	public Integer getFansNum() {
		if(this.fansNum==null){
			return 0;
		}
		return fansNum;
	}
	public void setFansNum(Integer fansNum) {
		this.fansNum = fansNum;
	}
	// 用户家族id
	private String familyId;
	@IgnoreColumn
	public String getFamilyId() {
		return familyId;
	}
	public void setFamilyId(String familyId) {
		this.familyId = familyId;
	}

	// 给上级的备注姓名
	private String super_remark_name;
	@FiledName("super_remark_name")
	public String getSuper_remark_name() {
		return super_remark_name;
	}
	public void setSuper_remark_name(String super_remark_name) {
		this.super_remark_name = super_remark_name;
	}

	private String address;
	@FiledName("address")
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	// 是否家族屏蔽消息 0：否 1：是
	private Integer shield;
	@IgnoreColumn
	public Integer getShield() {
		return shield == null ? 0 : shield;
	}
	public void setShield(Integer shield) {
		this.shield = shield;
	}

	/**
	 * 
	 * 赋值默认值
	 */
	public void defaultValue() {
		if(this.nick_name==null){
			setNick_name("");
		}
		if(this.mobile==null){
			setMobile("");
		}
		if(this.real_name==null){
			setReal_name("");
		}
		if(this.sex==null){
			setSex(1);;
		}
	}
}
